package com.zhang.network.constant;

import com.zhang.dto.BaseResponse;

/**
 * @author zhangshuaiyin
 * @date 2021-04-06 10:16
 */
public class BizResponse<T> extends BaseResponse<T> {

    private static final String NO_CODE = "000";
    private static final String NO_MESSAGE = "No Message";
    private static final String INFO_CODE = "100";
    private static final String INFO_MESSAGE = "info";
    private static final String SUCCESS_CODE = "200";
    private static final String SUCCESS_MESSAGE = "success";
    private static final String FAIL_CODE = "500";
    private static final String FAIL_MESSAGE = "fail";
    private static final String WARN_CODE = "300";
    private static final String WARN_MESSAGE = "warning";

    public static <T> BaseResponse<T> info() {
        return of(INFO_CODE, INFO_MESSAGE);
    }

    public static <T> BaseResponse<T> info(String retMsg) {
        return of(INFO_CODE, retMsg);
    }
    public static <T> BaseResponse<T> noMessage() {
        return of(NO_CODE, NO_MESSAGE);
    }

    public static <T> BaseResponse<T> noMessage(String retMsg) {
        return of(NO_CODE, retMsg);
    }
    public static <T> BaseResponse<T> fail() {
        return of(FAIL_CODE, FAIL_MESSAGE);
    }

    public static <T> BaseResponse<T> fail(String retMsg) {
        return of(FAIL_CODE, retMsg);
    }
    public static <T> BaseResponse<T> warn() {
        return of(WARN_CODE, WARN_MESSAGE);
    }
    public static <T> BaseResponse<T> warn(String retMsg) {
        return of(WARN_CODE, retMsg);
    }

    public static <T> BaseResponse<T> success() {
        return of(SUCCESS_CODE, SUCCESS_MESSAGE);
    }

    public static <T> BaseResponse<T> success(String retMsg) {
        return of(SUCCESS_CODE, retMsg);
    }

    public static <T> BaseResponse<T> success(T data) {
        return of(SUCCESS_CODE, SUCCESS_MESSAGE, data);
    }
}
